// API 响应码枚举
export enum ResponseCode {
  Success = 0,
  Unauthorized = 40001,
  Forbidden = 403,
  BadRequest = 400,
  ServerError = 500,
}

// API 通用响应格式
export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
  timestamp: string
}

// API 错误处理选项
export interface HandleApiErrorOptions {
  handleLogout?: () => void
  showError?: boolean
}

// 统一的返回格式 [error, result]
export type ApiResult<T> = Promise<[ApiResponse<T> | Error | null, T | null]>
